package ar.uba.fi.tp2Unit.framework;

import java.util.ArrayList;
import java.util.List;

/**
 * Represents a test to be run by {@link TestRunner}
 * 
 * @author grupo12
 * @see {@link TestRunner, TestCase, TestSuite}
 */
public abstract class Test {
	
	private final static String ALL = ".*";
	
	private TestSuite suite = null;
	
	public void setUp(TestFixture testFixture){}
	
	public abstract void test(TestResult testResult, String pattern, List<String> tags, TestFixture testFixture);	
	
	public void test(TestResult testResult, TestFixture testFixture){
		test(testResult, ALL, new ArrayList<String>(), testFixture);
	}
	
	public void test(TestResult testResult, String pattern, TestFixture testFixture){
		test(testResult, pattern, new ArrayList<String>(), testFixture);
	}
	
	public void test(TestResult testResult, List<String> runTags, TestFixture testFixture){
		test(testResult, ALL, runTags, testFixture);
	}
	
	public boolean matchesPattern(String pattern){
		return getName().matches(pattern);
	}
	
	public void tearDown(TestFixture testFixture){}	
	
	public abstract String getName();
	
	public TestSuite getTestSuite(){
		return suite;
	}
	
	public void setTestSuite(TestSuite suite){
		this.suite = suite;
	}

}
